/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xiashitech.agent.instrumentation.dubbo.common.inst;


import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.rpc.RpcAttributesGetter;
import org.jetbrains.annotations.Nullable;

enum DubboRpcAttributesGetter implements RpcAttributesGetter<DubboRequest> {
  INSTANCE;

// TODO: TO DEL ON NEXT Version (OTEL 版本升级变更 1.29.0)

//  @Override
//  public String system(DubboRequest request) {
//    return "apache_dubbo";
//  }
//
//  @Override
//  public String service(DubboRequest request) {
//    return request.getInvocation().getInvoker().getInterface().getName();
//  }
//
//  @Override
//  public String method(DubboRequest request) {
//    return request.getInvocation().getMethodName();
//  }

  @Nullable
  @Override
  public String getSystem(DubboRequest dubboRequest) {
    return "apache_dubbo";
  }

  @Nullable
  @Override
  public String getService(DubboRequest dubboRequest) {
    return dubboRequest.getInvocation().getInvoker().getInterface().getName();
  }

  @Nullable
  @Override
  public String getMethod(DubboRequest dubboRequest) {
    return dubboRequest.getInvocation().getMethodName();
  }
}
